/////////////////////////////////////////////////////////////////////////////
// Name:        samplesettingsdialog.cpp
// Purpose:     
// Author:      Julian Smart
// Modified by: 
// Created:     26/03/2009 08:54:36
// RCS-ID:      
// Copyright:   
// Licence:     
/////////////////////////////////////////////////////////////////////////////

// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wx.h"

////@begin includes
#include "wx/bookctrl.h"
////@end includes

#include "axsampleapp.h"
#include "samplesettingsdialog.h"
#include "tts/tts_speechsettingspanel.h"

////@begin XPM images
////@end XPM images


/*!
 * SampleSettingsDialog type definition
 */

IMPLEMENT_DYNAMIC_CLASS( SampleSettingsDialog, wxPropertySheetDialog )


/*!
 * SampleSettingsDialog event table definition
 */

BEGIN_EVENT_TABLE( SampleSettingsDialog, wxPropertySheetDialog )

////@begin SampleSettingsDialog event table entries
////@end SampleSettingsDialog event table entries

END_EVENT_TABLE()


/*!
 * SampleSettingsDialog constructors
 */

SampleSettingsDialog::SampleSettingsDialog()
{
    Init();
}

SampleSettingsDialog::SampleSettingsDialog( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
{
    Init();
    Create(parent, id, caption, pos, size, style);
}


/*!
 * SampleSettingsDialog creator
 */

bool SampleSettingsDialog::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
{
////@begin SampleSettingsDialog creation
    SetExtraStyle(wxWS_EX_VALIDATE_RECURSIVELY|wxWS_EX_BLOCK_EVENTS);
    SetSheetStyle(wxPROPSHEET_DEFAULT);
    wxPropertySheetDialog::Create( parent, id, caption, pos, size, style );

    CreateButtons(wxOK|wxCANCEL|wxHELP);
    CreateControls();
    LayoutDialog();
    Centre();
////@end SampleSettingsDialog creation

    return true;
}


/*!
 * SampleSettingsDialog destructor
 */

SampleSettingsDialog::~SampleSettingsDialog()
{
////@begin SampleSettingsDialog destruction
////@end SampleSettingsDialog destruction
}


/*!
 * Member initialisation
 */

void SampleSettingsDialog::Init()
{
////@begin SampleSettingsDialog member initialisation
    m_generalPage = NULL;
    m_speechSettingsPanel = NULL;
    m_contentSpeechSettingsPanel = NULL;
////@end SampleSettingsDialog member initialisation
}


/*!
 * Control creation for SampleSettingsDialog
 */

void SampleSettingsDialog::CreateControls()
{    
////@begin SampleSettingsDialog content construction
    SampleSettingsDialog* itemPropertySheetDialog1 = this;

    m_generalPage = new wxPanel( GetBookCtrl(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxNO_BORDER|wxTAB_TRAVERSAL );
    wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxVERTICAL);
    m_generalPage->SetSizer(itemBoxSizer3);

    wxBoxSizer* itemBoxSizer4 = new wxBoxSizer(wxVERTICAL);
    itemBoxSizer3->Add(itemBoxSizer4, 1, wxGROW|wxALL, 5);
    wxStaticText* itemStaticText5 = new wxStaticText( m_generalPage, wxID_STATIC, _("General settings"), wxDefaultPosition, wxDefaultSize, 0 );
    itemStaticText5->SetFont(wxFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).GetPointSize(), wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).GetFamily(), wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).GetStyle(), wxBOLD, false, wxT("")));
    itemBoxSizer4->Add(itemStaticText5, 0, wxALIGN_LEFT|wxALL, 5);

    itemBoxSizer4->Add(5, 5, 0, wxALIGN_CENTER_HORIZONTAL, 5);

    wxCheckBox* itemCheckBox7 = new wxCheckBox( m_generalPage, ID_CHECKBOX, _("Test toggle item"), wxDefaultPosition, wxDefaultSize, 0 );
    itemCheckBox7->SetValue(false);
    itemBoxSizer4->Add(itemCheckBox7, 0, wxALIGN_LEFT|wxALL, 5);

    GetBookCtrl()->AddPage(m_generalPage, _("General"));

    wxPanel* itemPanel8 = new wxPanel( GetBookCtrl(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxNO_BORDER|wxTAB_TRAVERSAL );
    wxBoxSizer* itemBoxSizer9 = new wxBoxSizer(wxVERTICAL);
    itemPanel8->SetSizer(itemBoxSizer9);

    wxStaticText* itemStaticText10 = new wxStaticText( itemPanel8, wxID_STATIC, _("Speech settings"), wxDefaultPosition, wxDefaultSize, 0 );
    itemStaticText10->SetFont(wxFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).GetPointSize(), wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).GetFamily(), wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).GetStyle(), wxBOLD, false, wxT("")));
    itemBoxSizer9->Add(itemStaticText10, 0, wxALIGN_LEFT|wxALL, 5);

    itemBoxSizer9->Add(5, 5, 0, wxALIGN_CENTER_HORIZONTAL, 5);

    wxNotebook* itemNotebook12 = new wxNotebook( itemPanel8, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBK_DEFAULT );

    m_speechSettingsPanel = new wxTTSSpeechSettingsPanel( itemNotebook12, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxNO_BORDER|wxTAB_TRAVERSAL );

    itemNotebook12->AddPage(m_speechSettingsPanel, _("Main Channel"));

    m_contentSpeechSettingsPanel = new wxTTSSpeechSettingsPanel( itemNotebook12, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxNO_BORDER|wxTAB_TRAVERSAL );

    itemNotebook12->AddPage(m_contentSpeechSettingsPanel, _("Content Channel"));

    itemBoxSizer9->Add(itemNotebook12, 0, wxGROW|wxALL, 5);

    GetBookCtrl()->AddPage(itemPanel8, _("Speech"));

    // Set validators
    itemCheckBox7->SetValidator( wxGenericValidator(& wxGetApp().m_toggle) );
////@end SampleSettingsDialog content construction

    wxUnusedVar(itemPropertySheetDialog1);

    m_speechSettingsPanel->SetInfo(wxGetApp().GetViewManager().GetSpeech().GetSpeechSettingsInfo(AxSpeechMainChannel));
    m_contentSpeechSettingsPanel->SetInfo(wxGetApp().GetViewManager().GetSpeech().GetSpeechSettingsInfo(AxSpeechContentChannel));

    m_adapter.Adapt(this);
}

/*!
 * Should we show tooltips?
 */

bool SampleSettingsDialog::ShowToolTips()
{
    return true;
}

/*!
 * Get bitmap resources
 */

wxBitmap SampleSettingsDialog::GetBitmapResource( const wxString& name )
{
    // Bitmap retrieval
////@begin SampleSettingsDialog bitmap retrieval
    wxUnusedVar(name);
    return wxNullBitmap;
////@end SampleSettingsDialog bitmap retrieval
}

/*!
 * Get icon resources
 */

wxIcon SampleSettingsDialog::GetIconResource( const wxString& name )
{
    // Icon retrieval
////@begin SampleSettingsDialog icon retrieval
    wxUnusedVar(name);
    return wxNullIcon;
////@end SampleSettingsDialog icon retrieval
}

/// Data transfer
bool SampleSettingsDialog::TransferDataFromWindow()
{
    wxPropertySheetDialog::TransferDataFromWindow();

    wxGetApp().GetViewManager().GetSpeech().GetSpeechSettingsInfo(AxSpeechMainChannel) = m_speechSettingsPanel->GetInfo();
    wxGetApp().GetViewManager().GetSpeech().GetSpeechSettingsInfo(AxSpeechMainChannel).ApplySettings();

    wxGetApp().GetViewManager().GetSpeech().GetSpeechSettingsInfo(AxSpeechContentChannel) = m_contentSpeechSettingsPanel->GetInfo();
    wxGetApp().GetViewManager().GetSpeech().GetSpeechSettingsInfo(AxSpeechContentChannel).ApplySettings();

    //wxGetApp().GetMP3SettingsInfo() = m_mp3SettingsPanel->GetInfo();

    return true;
}
